#include<stdio.h>
static int string_char(char *string, char ctc);
int main(void)
{
    char string1[] = "Hello world"; //字符数组存储字符串指针.char []--数组形式
    char *string2 = "Hello world";  //字符指针指向字符串常量.char * --指针变量
    char *string3 = string1;        //指向字符数组的指针
    printf("The length of string1 is %d\n", string_char(string1, '0'));
    printf("The length of string2 is %d\n", string_char(string2, 'H'));
    printf("The length of string3 is %d\n", string_char(string3, 'd'));
    return 0;
    return 0;
}
static int string_char(char *string, char ctc)
{
    char *str_pt;
    str_pt = string;
    int loop_time;
    int ret_val = 0;
    while(*str_pt != '\0')
    {
        if(*str_pt == ctc)
        {
            ret_val = loop_time + 1;
            break;
        }
        str_pt ++;
        loop_time ++;
    }
    return ret_val;
}
